package com.ant.common.constant;

/**
 * @author LB
 */
public class RequestConstant {

    /**
     * token名称
     */
    public static final String TOKEN = "token";

    /**
     * 忽略的路径，全路径
     */
    public final static String[] IGNORE_ALL_PATH = new String[]{"/", "/login", "/webSocket"};
    /**
     * 忽略的路径，包含路径（部分）
     */
    public final static String[] IGNORE_PART_PATH = new String[]{"/static/"};

    public final static String IP_UTILS_FLAG = ",";
    public final static String UNKNOWN = "unknown";
    public final static String LOCALHOST_IP = "0:0:0:0:0:0:0:1";
    public final static String LOCALHOST_IP1 = "127.0.0.1";

    /**
     * 返回数据枚举
     */
    public enum WRAPPED_RESULT_TYPE {
        //错误类
        ERROR("error", 0),
        //警告类
        WARN("warn", 1),
        //info类
        INFO("info", 2),
        //系统类
        SYSTEM("system", 3);

        private String name;
        private int index;

        WRAPPED_RESULT_TYPE(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public int getIndex() {
            return this.index;
        }

        public String getName() {
            return this.name;
        }

    }

    /**
     * 返回结果枚举
     */
    public enum WRAPPED_RESULT_CODE {
        //成功
        CODE_O("successful", 700),
        //登录错误
        CODE_1("loginError", 701),
        //业务错误
        CODE_2("businessError", 702),
        //多用户
        CODE_3("multiUser", 703);

        private int code;
        private String name;

        WRAPPED_RESULT_CODE(String name, int code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 登录用户类型
     */
    public enum AUTH_USER_TYPE {
        TYPE_0("user", 0),
        TYPE_1("person", 1);

        private int code;
        private String name;

        AUTH_USER_TYPE(String name, int code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
}
